<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: logger   LogReader.js  (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/api.css">
    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">

	<div id="hd">
        <a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
        <h3>Logger Widget&nbsp; <span class="subtitle">2.3.1</span></h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_logger.html">logger</a>
                
                 &gt; LogReader.js (source view) 
            </p>

	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form name="yui-classopts-form">
    <span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> Show Private</span>
    <span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> Show Protected</span>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 #classopts { display:none; }
                        </style>
<div class="highlight" ><pre><span class="c">/****************************************************************************/</span>
<span class="c">/****************************************************************************/</span>
<span class="c">/****************************************************************************/</span>

<span class="c">/**</span>
<span class="c"> * The LogReader class provides UI to read messages logged to YAHOO.widget.Logger.</span>
<span class="c"> *</span>
<span class="c"> * @class LogReader</span>
<span class="c"> * @constructor</span>
<span class="c"> * @param elContainer {HTMLElement} (optional) DOM element reference of an existing DIV.</span>
<span class="c"> * @param elContainer {String} (optional) String ID of an existing DIV.</span>
<span class="c"> * @param oConfigs {Object} (optional) Object literal of configuration params.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">elContainer</span><span class="o">,</span> <span class="nx">oConfigs</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_sName</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">_index</span><span class="o">;</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">_index</span><span class="o">++;</span>
    
    <span class="c">// Internal vars</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_buffer</span> <span class="o">=</span> <span class="o">[];</span> <span class="c">// output buffer</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_filterCheckboxes</span> <span class="o">=</span> <span class="o">{};</span> <span class="c">// pointers to checkboxes</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_lastTime</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">getStartTime</span><span class="o">();</span> <span class="c">// timestamp of last log message to console</span>
<span class="c"></span>
    <span class="c">// Parse config vars here</span>
<span class="c"></span>    <span class="k">if</span> <span class="o">(</span><span class="nx">oConfigs</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">oConfigs</span><span class="o">.</span><span class="nx">constructor</span> <span class="o">==</span> <span class="nb">Object</span><span class="o">))</span> <span class="o">{</span>
        <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">param</span> <span class="k">in</span> <span class="nx">oConfigs</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">this</span><span class="o">[</span><span class="nx">param</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oConfigs</span><span class="o">[</span><span class="nx">param</span><span class="o">];</span>
        <span class="o">}</span>
    <span class="o">}</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_initContainerEl</span><span class="o">(</span><span class="nx">elContainer</span><span class="o">);</span>
    <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;Could not instantiate LogReader due to an invalid container element &quot;</span> <span class="o">+</span>
                <span class="nx">elContainer</span><span class="o">,</span> <span class="s2">&quot;error&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
        <span class="k">return</span><span class="o">;</span>
    <span class="o">}</span>
    
    <span class="k">this</span><span class="o">.</span><span class="nx">_initHeaderEl</span><span class="o">();</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_initConsoleEl</span><span class="o">();</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_initFooterEl</span><span class="o">();</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_initDragDrop</span><span class="o">();</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_initCategories</span><span class="o">();</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_initSources</span><span class="o">();</span>

    <span class="c">// Subscribe to Logger custom events</span>
<span class="c"></span>    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">newLogEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onNewLog</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">logResetEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onReset</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>

    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">categoryCreateEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onCategoryCreate</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">sourceCreateEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onSourceCreate</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;LogReader initialized&quot;</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="o">};</span>

<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c">//</span>
<span class="c">// Public member variables</span>
<span class="c">//</span>
<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * Whether or not LogReader is enabled to output log messages.</span>
<span class="c"> *</span>
<span class="c"> * @property logReaderEnabled</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default true</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">logReaderEnabled</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS width of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property width</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">width</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS height of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property height</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">height</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS top position of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property top</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">top</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS left position of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property left</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">left</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS right position of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property right</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">right</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS bottom position of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property bottom</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">bottom</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Public member to access CSS font size of the LogReader container.</span>
<span class="c"> *</span>
<span class="c"> * @property fontSize</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">fontSize</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Whether or not the footer UI is enabled for the LogReader.</span>
<span class="c"> *</span>
<span class="c"> * @property footerEnabled</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default true</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">footerEnabled</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Whether or not output is verbose (more readable). Setting to true will make</span>
<span class="c"> * output more compact (less readable).</span>
<span class="c"> *</span>
<span class="c"> * @property verboseOutput</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default true</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">verboseOutput</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Whether or not newest message is printed on top.</span>
<span class="c"> *</span>
<span class="c"> * @property newestOnTop</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">newestOnTop</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Output timeout buffer in milliseconds.</span>
<span class="c"> *</span>
<span class="c"> * @property outputBuffer</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 100</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">outputBuffer</span> <span class="o">=</span> <span class="m">100</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Maximum number of messages a LogReader console will display.</span>
<span class="c"> *</span>
<span class="c"> * @property thresholdMax</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 500</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">thresholdMax</span> <span class="o">=</span> <span class="m">500</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * When a LogReader console reaches its thresholdMax, it will clear out messages</span>
<span class="c"> * and print out the latest thresholdMin number of messages.</span>
<span class="c"> *</span>
<span class="c"> * @property thresholdMin</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 100</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">thresholdMin</span> <span class="o">=</span> <span class="m">100</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * True when LogReader is in a collapsed state, false otherwise.</span>
<span class="c"> *</span>
<span class="c"> * @property isCollapsed</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default false</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">isCollapsed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * True when LogReader is in a paused state, false otherwise.</span>
<span class="c"> *</span>
<span class="c"> * @property isPaused</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default false</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">isPaused</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Enables draggable LogReader if DragDrop Utility is present.</span>
<span class="c"> *</span>
<span class="c"> * @property draggable</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default true</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">draggable</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c">//</span>
<span class="c">// Public methods</span>
<span class="c">//</span>
<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c"></span>
 <span class="c">/**</span>
<span class="c"> * Public accessor to the unique name of the LogReader instance.</span>
<span class="c"> *</span>
<span class="c"> * @method toString</span>
<span class="c"> * @return {String} Unique name of the LogReader instance.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">toString</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="s2">&quot;LogReader instance&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sName</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * Pauses output of log messages. While paused, log messages are not lost, but</span>
<span class="c"> * get saved to a buffer and then output upon resume of LogReader.</span>
<span class="c"> *</span>
<span class="c"> * @method pause</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">pause</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">isPaused</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Resume&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">logReaderEnabled</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Resumes output of log messages, including outputting any log messages that</span>
<span class="c"> * have been saved to buffer while paused.</span>
<span class="c"> *</span>
<span class="c"> * @method resume</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">resume</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">isPaused</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Pause&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">logReaderEnabled</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_printBuffer</span><span class="o">();</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Hides UI of LogReader. Logging functionality is not disrupted.</span>
<span class="c"> *</span>
<span class="c"> * @method hide</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">hide</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Shows UI of LogReader. Logging functionality is not disrupted.</span>
<span class="c"> *</span>
<span class="c"> * @method show</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">show</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Collapses UI of LogReader. Logging functionality is not disrupted.</span>
<span class="c"> *</span>
<span class="c"> * @method collapse</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">collapse</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
    <span class="o">}</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Expand&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">isCollapsed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Expands UI of LogReader. Logging functionality is not disrupted.</span>
<span class="c"> *</span>
<span class="c"> * @method expand</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">expand</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="o">;</span>
    <span class="o">}</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Collapse&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">isCollapsed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Returns related checkbox element for given filter (i.e., category or source).</span>
<span class="c"> *</span>
<span class="c"> * @method getCheckbox</span>
<span class="c"> * @param {String} Category or source name.</span>
<span class="c"> * @return {Array} Array of all filter checkboxes.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">getCheckbox</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">filter</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_filterCheckboxes</span><span class="o">[</span><span class="nx">filter</span><span class="o">];</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Returns array of enabled categories.</span>
<span class="c"> *</span>
<span class="c"> * @method getCategories</span>
<span class="c"> * @return {String[]} Array of enabled categories.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">getCategories</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Shows log messages associated with given category.</span>
<span class="c"> *</span>
<span class="c"> * @method showCategory</span>
<span class="c"> * @param {String} Category name.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">showCategory</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">filtersArray</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">;</span>
    <span class="c">// Don&#39;t do anything if category is already enabled</span>
<span class="c"></span>    <span class="c">// Use Array.indexOf if available...</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">)</span> <span class="o">{</span>
         <span class="k">if</span><span class="o">(</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">)</span> <span class="o">&gt;</span>  <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
    <span class="c">// ...or do it the old-fashioned way</span>
<span class="c"></span>    <span class="k">else</span> <span class="o">{</span>
        <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
           <span class="k">if</span><span class="o">(</span><span class="nx">filtersArray</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">===</span> <span class="nx">sCategory</span><span class="o">){</span>
                <span class="k">return</span><span class="o">;</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">}</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">);</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">elCheckbox</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getCheckbox</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">);</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">elCheckbox</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">elCheckbox</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Hides log messages associated with given category.</span>
<span class="c"> *</span>
<span class="c"> * @method hideCategory</span>
<span class="c"> * @param {String} Category name.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">hideCategory</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">filtersArray</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">;</span>
    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
        <span class="k">if</span><span class="o">(</span><span class="nx">sCategory</span> <span class="o">==</span> <span class="nx">filtersArray</span><span class="o">[</span><span class="nx">i</span><span class="o">])</span> <span class="o">{</span>
            <span class="nx">filtersArray</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
            <span class="k">break</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">elCheckbox</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getCheckbox</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">);</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">elCheckbox</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">elCheckbox</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Returns array of enabled sources.</span>
<span class="c"> *</span>
<span class="c"> * @method getSources</span>
<span class="c"> * @return {Array} Array of enabled sources.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">getSources</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Shows log messages associated with given source.</span>
<span class="c"> *</span>
<span class="c"> * @method showSource</span>
<span class="c"> * @param {String} Source name.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">showSource</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sSource</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">filtersArray</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">;</span>
    <span class="c">// Don&#39;t do anything if category is already enabled</span>
<span class="c"></span>    <span class="c">// Use Array.indexOf if available...</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">)</span> <span class="o">{</span>
         <span class="k">if</span><span class="o">(</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">sSource</span><span class="o">)</span> <span class="o">&gt;</span>  <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
    <span class="c">// ...or do it the old-fashioned way</span>
<span class="c"></span>    <span class="k">else</span> <span class="o">{</span>
        <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
           <span class="k">if</span><span class="o">(</span><span class="nx">sSource</span> <span class="o">==</span> <span class="nx">filtersArray</span><span class="o">[</span><span class="nx">i</span><span class="o">]){</span>
                <span class="k">return</span><span class="o">;</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">}</span>
    <span class="nx">filtersArray</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">sSource</span><span class="o">);</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">elCheckbox</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getCheckbox</span><span class="o">(</span><span class="nx">sSource</span><span class="o">);</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">elCheckbox</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">elCheckbox</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Hides log messages associated with given source.</span>
<span class="c"> *</span>
<span class="c"> * @method hideSource</span>
<span class="c"> * @param {String} Source name.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">hideSource</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sSource</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">filtersArray</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">;</span>
    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">filtersArray</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
        <span class="k">if</span><span class="o">(</span><span class="nx">sSource</span> <span class="o">==</span> <span class="nx">filtersArray</span><span class="o">[</span><span class="nx">i</span><span class="o">])</span> <span class="o">{</span>
            <span class="nx">filtersArray</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
            <span class="k">break</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">elCheckbox</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getCheckbox</span><span class="o">(</span><span class="nx">sSource</span><span class="o">);</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">elCheckbox</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">elCheckbox</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Does not delete any log messages, but clears all printed log messages from</span>
<span class="c"> * the console. Log messages will be printed out again if user re-filters. The</span>
<span class="c"> * static method YAHOO.widget.Logger.reset() should be called in order to</span>
<span class="c"> * actually delete log messages.</span>
<span class="c"> *</span>
<span class="c"> * @method clearConsole</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">clearConsole</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// Clear the buffer of any pending messages</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_buffer</span> <span class="o">=</span> <span class="o">[];</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_consoleMsgCount</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>

    <span class="k">var</span> <span class="nx">elConsole</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">;</span>
    <span class="k">while</span><span class="o">(</span><span class="nx">elConsole</span><span class="o">.</span><span class="nx">hasChildNodes</span><span class="o">())</span> <span class="o">{</span>
        <span class="nx">elConsole</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">elConsole</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Updates title to given string.</span>
<span class="c"> *</span>
<span class="c"> * @method setTitle</span>
<span class="c"> * @param sTitle {String} New title.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">setTitle</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sTitle</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_title</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">html2Text</span><span class="o">(</span><span class="nx">sTitle</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Gets timestamp of the last log.</span>
<span class="c"> *</span>
<span class="c"> * @method getLastTime</span>
<span class="c"> * @return {Date} Timestamp of the last log.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">getLastTime</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_lastTime</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Formats message string to HTML for output to console.</span>
<span class="c"> *</span>
<span class="c"> * @method formatMsg</span>
<span class="c"> * @param oLogMsg {Object} Log message object.</span>
<span class="c"> * @return {String} HTML-formatted message for output to console.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">formatMsg</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">oLogMsg</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">category</span> <span class="o">=</span> <span class="nx">oLogMsg</span><span class="o">.</span><span class="nx">category</span><span class="o">;</span>
    
    <span class="c">// Label for color-coded display</span>
<span class="c"></span>    <span class="k">var</span> <span class="k">label</span> <span class="o">=</span> <span class="nx">category</span><span class="o">.</span><span class="nx">substring</span><span class="o">(</span><span class="m">0</span><span class="o">,</span><span class="m">4</span><span class="o">).</span><span class="nx">toUpperCase</span><span class="o">();</span>

    <span class="c">// Calculate the elapsed time to be from the last item that passed through the filter,</span>
<span class="c"></span>    <span class="c">// not the absolute previous item in the stack</span>
<span class="c"></span>
    <span class="k">var</span> <span class="nx">time</span> <span class="o">=</span> <span class="nx">oLogMsg</span><span class="o">.</span><span class="nx">time</span><span class="o">;</span>
    <span class="k">if</span> <span class="o">(</span><span class="nx">time</span><span class="o">.</span><span class="nx">toLocaleTimeString</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">localTime</span>  <span class="o">=</span> <span class="nx">time</span><span class="o">.</span><span class="nx">toLocaleTimeString</span><span class="o">();</span>
    <span class="o">}</span>
    <span class="k">else</span> <span class="o">{</span>
        <span class="nx">localTime</span> <span class="o">=</span> <span class="nx">time</span><span class="o">.</span><span class="nx">toString</span><span class="o">();</span>
    <span class="o">}</span>

    <span class="k">var</span> <span class="nx">msecs</span> <span class="o">=</span> <span class="nx">time</span><span class="o">.</span><span class="nx">getTime</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">startTime</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">getStartTime</span><span class="o">();</span>
    <span class="k">var</span> <span class="nx">totalTime</span> <span class="o">=</span> <span class="nx">msecs</span> <span class="o">-</span> <span class="nx">startTime</span><span class="o">;</span>
    <span class="k">var</span> <span class="nx">elapsedTime</span> <span class="o">=</span> <span class="nx">msecs</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">getLastTime</span><span class="o">();</span>

    <span class="k">var</span> <span class="nx">source</span> <span class="o">=</span> <span class="nx">oLogMsg</span><span class="o">.</span><span class="nx">source</span><span class="o">;</span>
    <span class="k">var</span> <span class="nx">sourceDetail</span> <span class="o">=</span> <span class="nx">oLogMsg</span><span class="o">.</span><span class="nx">sourceDetail</span><span class="o">;</span>
    <span class="k">var</span> <span class="nx">sourceAndDetail</span> <span class="o">=</span> <span class="o">(</span><span class="nx">sourceDetail</span><span class="o">)</span> <span class="o">?</span>
        <span class="nx">source</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="nx">sourceDetail</span> <span class="o">:</span> <span class="nx">source</span><span class="o">;</span>
        
    
    <span class="c">// Escape HTML entities in the log message itself for output to console</span>
<span class="c"></span>    <span class="c">//var msg = this.html2Text(oLogMsg.msg); //TODO: delete</span>
<span class="c"></span>    <span class="k">var</span> <span class="nx">msg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">html2Text</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">dump</span><span class="o">(</span><span class="nx">oLogMsg</span><span class="o">.</span><span class="nx">msg</span><span class="o">));</span>

    <span class="c">// Verbose output includes extra line breaks</span>
<span class="c"></span>    <span class="k">var</span> <span class="nx">output</span> <span class="o">=</span>  <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">verboseOutput</span><span class="o">)</span> <span class="o">?</span>
        <span class="o">[</span><span class="s2">&quot;&lt;pre class=\&quot;yui-log-verbose\&quot;&gt;&lt;p&gt;&lt;span class=&#39;&quot;</span><span class="o">,</span> <span class="nx">category</span><span class="o">,</span> <span class="s2">&quot;&#39;&gt;&quot;</span><span class="o">,</span> <span class="k">label</span><span class="o">,</span> <span class="s2">&quot;&lt;/span&gt; &quot;</span><span class="o">,</span>
        <span class="nx">totalTime</span><span class="o">,</span> <span class="s2">&quot;ms (+&quot;</span><span class="o">,</span> <span class="nx">elapsedTime</span><span class="o">,</span> <span class="s2">&quot;) &quot;</span><span class="o">,</span>
        <span class="nx">localTime</span><span class="o">,</span> <span class="s2">&quot;: &quot;</span><span class="o">,</span>
        <span class="s2">&quot;&lt;/p&gt;&lt;p&gt;&quot;</span><span class="o">,</span>
        <span class="nx">sourceAndDetail</span><span class="o">,</span>
        <span class="s2">&quot;: &lt;/p&gt;&lt;p&gt;&quot;</span><span class="o">,</span>
        <span class="nx">msg</span><span class="o">,</span>
        <span class="s2">&quot;&lt;/p&gt;&lt;/pre&gt;&quot;</span><span class="o">]</span> <span class="o">:</span>

        <span class="o">[</span><span class="s2">&quot;&lt;pre&gt;&lt;p&gt;&lt;span class=&#39;&quot;</span><span class="o">,</span> <span class="nx">category</span><span class="o">,</span> <span class="s2">&quot;&#39;&gt;&quot;</span><span class="o">,</span> <span class="k">label</span><span class="o">,</span> <span class="s2">&quot;&lt;/span&gt; &quot;</span><span class="o">,</span>
        <span class="nx">totalTime</span><span class="o">,</span> <span class="s2">&quot;ms (+&quot;</span><span class="o">,</span> <span class="nx">elapsedTime</span><span class="o">,</span> <span class="s2">&quot;) &quot;</span><span class="o">,</span>
        <span class="nx">localTime</span><span class="o">,</span> <span class="s2">&quot;: &quot;</span><span class="o">,</span>
        <span class="nx">sourceAndDetail</span><span class="o">,</span> <span class="s2">&quot;: &quot;</span><span class="o">,</span>
        <span class="nx">msg</span><span class="o">,</span> <span class="s2">&quot;&lt;/p&gt;&lt;/pre&gt;&quot;</span><span class="o">];</span>

    <span class="k">return</span> <span class="nx">output</span><span class="o">.</span><span class="nx">join</span><span class="o">(</span><span class="s2">&quot;&quot;</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Converts input chars &quot;&lt;&quot;, &quot;&gt;&quot;, and &quot;&amp;&quot; to HTML entities.</span>
<span class="c"> *</span>
<span class="c"> * @method html2Text</span>
<span class="c"> * @param sHtml {String} String to convert.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">html2Text</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sHtml</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">sHtml</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">sHtml</span> <span class="o">+=</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
        <span class="k">return</span> <span class="nx">sHtml</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="sr">/&amp;/g</span><span class="o">,</span> <span class="s2">&quot;&amp;#38;&quot;</span><span class="o">).</span><span class="nx">replace</span><span class="o">(</span><span class="sr">/&lt;/g</span><span class="o">,</span> <span class="s2">&quot;&amp;#60;&quot;</span><span class="o">).</span><span class="nx">replace</span><span class="o">(</span><span class="sr">/&gt;/g</span><span class="o">,</span> <span class="s2">&quot;&amp;#62;&quot;</span><span class="o">);</span>
    <span class="o">}</span>
    <span class="k">return</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c">//</span>
<span class="c">// Private member variables</span>
<span class="c">//</span>
<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * Internal class member to index multiple LogReader instances.</span>
<span class="c"> *</span>
<span class="c"> * @property _memberName</span>
<span class="c"> * @static</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 0</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">_index</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Name of LogReader instance.</span>
<span class="c"> *</span>
<span class="c"> * @property _sName</span>
<span class="c"> * @type String</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_sName</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">//TODO: remove</span>
<span class="c">/**</span>
<span class="c"> * A class member shared by all LogReaders if a container needs to be</span>
<span class="c"> * created during instantiation. Will be null if a container element never needs to</span>
<span class="c"> * be created on the fly, such as when the implementer passes in their own element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elDefaultContainer</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="c">//YAHOO.widget.LogReader._elDefaultContainer = null;</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * Buffer of log message objects for batch output.</span>
<span class="c"> *</span>
<span class="c"> * @property _buffer</span>
<span class="c"> * @type Object[]</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_buffer</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Number of log messages output to console.</span>
<span class="c"> *</span>
<span class="c"> * @property _consoleMsgCount</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 0</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_consoleMsgCount</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Date of last output log message.</span>
<span class="c"> *</span>
<span class="c"> * @property _lastTime</span>
<span class="c"> * @type Date</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_lastTime</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Batched output timeout ID.</span>
<span class="c"> *</span>
<span class="c"> * @property _timeout</span>
<span class="c"> * @type Number</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Hash of filters and their related checkbox elements.</span>
<span class="c"> *</span>
<span class="c"> * @property _filterCheckboxes</span>
<span class="c"> * @type Object</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_filterCheckboxes</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Array of filters for log message categories.</span>
<span class="c"> *</span>
<span class="c"> * @property _categoryFilters</span>
<span class="c"> * @type String[]</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_categoryFilters</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Array of filters for log message sources.</span>
<span class="c"> *</span>
<span class="c"> * @property _sourceFilters</span>
<span class="c"> * @type String[]</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_sourceFilters</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader container element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elContainer</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader header element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elHd</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elHd</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader collapse element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elCollapse</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elCollapse</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader collapse button element.</span>
<span class="c"> *</span>
<span class="c"> * @property _btnCollapse</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_btnCollapse</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader title header element.</span>
<span class="c"> *</span>
<span class="c"> * @property _title</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_title</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader console element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elConsole</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elConsole</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader footer element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elFt</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elFt</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader buttons container element.</span>
<span class="c"> *</span>
<span class="c"> * @property _elBtns</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elBtns</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Container element for LogReader category filter checkboxes.</span>
<span class="c"> *</span>
<span class="c"> * @property _elCategoryFilters</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elCategoryFilters</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Container element for LogReader source filter checkboxes.</span>
<span class="c"> *</span>
<span class="c"> * @property _elSourceFilters</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_elSourceFilters</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * LogReader pause button element.</span>
<span class="c"> *</span>
<span class="c"> * @property _btnPause</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_btnPause</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Clear button element.</span>
<span class="c"> *</span>
<span class="c"> * @property _btnClear</span>
<span class="c"> * @type HTMLElement</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_btnClear</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c">//</span>
<span class="c">// Private methods</span>
<span class="c">//</span>
<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * Initializes the primary container element.</span>
<span class="c"> *</span>
<span class="c"> * @method _initContainerEl</span>
<span class="c"> * @param elContainer {HTMLElement} Container element by reference or string ID.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initContainerEl</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">elContainer</span><span class="o">)</span> <span class="o">{</span>
    <span class="c">// Validate container</span>
<span class="c"></span>    <span class="nx">elContainer</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">elContainer</span><span class="o">);</span>
    <span class="c">// Attach to existing container...</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="nx">elContainer</span> <span class="o">&amp;&amp;</span> <span class="nx">elContainer</span><span class="o">.</span><span class="nx">tagName</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">elContainer</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toLowerCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">&quot;div&quot;</span><span class="o">))</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="nx">elContainer</span><span class="o">;</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">,</span><span class="s2">&quot;yui-log&quot;</span><span class="o">);</span>
    <span class="o">}</span>
    <span class="c">// ...or create container from scratch</span>
<span class="c"></span>    <span class="k">else</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
        <span class="c">//this._elContainer.id = &quot;yui-log&quot; + this._sName;</span>
<span class="c"></span>        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">,</span><span class="s2">&quot;yui-log&quot;</span><span class="o">);</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">,</span><span class="s2">&quot;yui-log-container&quot;</span><span class="o">);</span>

        <span class="c">//YAHOO.widget.LogReader._elDefaultContainer = this._elContainer;</span>
<span class="c"></span>
        <span class="c">// If implementer has provided container values, trust and set those</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">containerStyle</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">style</span><span class="o">;</span>
        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">width</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">width</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">width</span><span class="o">;</span>
        <span class="o">}</span>
        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">right</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">right</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">right</span><span class="o">;</span>
        <span class="o">}</span>
        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">top</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">top</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">top</span><span class="o">;</span>
        <span class="o">}</span>
         <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">left</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">left</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">left</span><span class="o">;</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">right</span> <span class="o">=</span> <span class="s2">&quot;auto&quot;</span><span class="o">;</span>
        <span class="o">}</span>
        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">bottom</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">bottom</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">bottom</span><span class="o">;</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">top</span> <span class="o">=</span> <span class="s2">&quot;auto&quot;</span><span class="o">;</span>
        <span class="o">}</span>
       <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">fontSize</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">containerStyle</span><span class="o">.</span><span class="nx">fontSize</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">fontSize</span><span class="o">;</span>
        <span class="o">}</span>
        <span class="c">// For Opera</span>
<span class="c"></span>        <span class="k">if</span><span class="o">(</span><span class="nx">navigator</span><span class="o">.</span><span class="nx">userAgent</span><span class="o">.</span><span class="nx">toLowerCase</span><span class="o">().</span><span class="nx">indexOf</span><span class="o">(</span><span class="s2">&quot;opera&quot;</span><span class="o">)</span> <span class="o">!=</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">style</span> <span class="o">+=</span> <span class="s1">&#39;&#39;</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes the header element.</span>
<span class="c"> *</span>
<span class="c"> * @method _initHeaderEl</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initHeaderEl</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

    <span class="c">// Destroy header</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">)</span> <span class="o">{</span>
        <span class="c">// Unhook DOM events</span>
<span class="c"></span>        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

        <span class="c">// Remove DOM elements</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
    <span class="o">}</span>
    
    <span class="c">// Create header</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="s2">&quot;yui-log-hd&quot;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sName</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-hd&quot;</span><span class="o">;</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_elCollapse</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elCollapse</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-btns&quot;</span><span class="o">;</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;input&quot;</span><span class="o">);</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">&quot;button&quot;</span><span class="o">;</span>
    <span class="c">//this._btnCollapse.style.fontSize =</span>
<span class="c"></span>    <span class="c">//    YAHOO.util.Dom.getStyle(this._elContainer,&quot;fontSize&quot;);</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-button&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Collapse&quot;</span><span class="o">;</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elCollapse</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">);</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_btnCollapse</span><span class="o">,</span><span class="s1">&#39;click&#39;</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_onClickCollapseBtn</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">);</span>

    <span class="k">this</span><span class="o">.</span><span class="nx">_title</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;h4&quot;</span><span class="o">));</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_title</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;Logger Console&quot;</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes the console element.</span>
<span class="c"> *</span>
<span class="c"> * @method _initConsoleEl</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initConsoleEl</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// Destroy console</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">)</span> <span class="o">{</span>
        <span class="c">// Unhook DOM events</span>
<span class="c"></span>        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

        <span class="c">// Remove DOM elements</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="c">// Ceate console</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-bd&quot;</span><span class="o">;</span>

    <span class="c">// If implementer has provided console, trust and set those</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">height</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">height</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">height</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes the footer element.</span>
<span class="c"> *</span>
<span class="c"> * @method _initFooterEl</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initFooterEl</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

    <span class="c">// Don&#39;t create footer elements if footer is disabled</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">footerEnabled</span><span class="o">)</span> <span class="o">{</span>
        <span class="c">// Destroy console</span>
<span class="c"></span>        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
            <span class="c">// Unhook DOM events</span>
<span class="c"></span>            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

            <span class="c">// Remove DOM elements</span>
<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="o">;</span>
        <span class="o">}</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-ft&quot;</span><span class="o">;</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_elBtns</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elBtns</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-btns&quot;</span><span class="o">;</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;input&quot;</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">&quot;button&quot;</span><span class="o">;</span>
        <span class="c">//this._btnPause.style.fontSize =</span>
<span class="c"></span>        <span class="c">//    YAHOO.util.Dom.getStyle(this._elContainer,&quot;fontSize&quot;);</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-button&quot;</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Pause&quot;</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elBtns</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">);</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span>
            <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_btnPause</span><span class="o">,</span><span class="s1">&#39;click&#39;</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_onClickPauseBtn</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;input&quot;</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">&quot;button&quot;</span><span class="o">;</span>
        <span class="c">//this._btnClear.style.fontSize =</span>
<span class="c"></span>        <span class="c">//    YAHOO.util.Dom.getStyle(this._elContainer,&quot;fontSize&quot;);</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-button&quot;</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="s2">&quot;Clear&quot;</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elBtns</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_btnClear</span><span class="o">);</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span>
            <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_btnClear</span><span class="o">,</span><span class="s1">&#39;click&#39;</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_onClickClearBtn</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_elCategoryFilters</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elCategoryFilters</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-categoryfilters&quot;</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elSourceFilters</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">));</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_elSourceFilters</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-sourcefilters&quot;</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes Drag and Drop on the header element.</span>
<span class="c"> *</span>
<span class="c"> * @method _initDragDrop</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initDragDrop</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// If Drag and Drop utility is available...</span>
<span class="c"></span>    <span class="c">// ...and draggable is true...</span>
<span class="c"></span>    <span class="c">// ...then make the header draggable</span>
<span class="c"></span>    <span class="k">if</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">draggable</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">ylog_dd</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elContainer</span><span class="o">);</span>
        <span class="nx">ylog_dd</span><span class="o">.</span><span class="nx">setHandleElId</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
        <span class="c">//TODO: use class name</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_elHd</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">cursor</span> <span class="o">=</span> <span class="s2">&quot;move&quot;</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes category filters.</span>
<span class="c"> *</span>
<span class="c"> * @method _initCategories</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initCategories</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// Initialize category filters</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span> <span class="o">=</span> <span class="o">[];</span>
    <span class="k">var</span> <span class="nx">aInitialCategories</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">categories</span><span class="o">;</span>

    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">j</span> <span class="o">&lt;</span> <span class="nx">aInitialCategories</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">j</span><span class="o">++)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">sCategory</span> <span class="o">=</span> <span class="nx">aInitialCategories</span><span class="o">[</span><span class="nx">j</span><span class="o">];</span>

        <span class="c">// Add category to the internal array of filters</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">);</span>

        <span class="c">// Add checkbox element if UI is enabled</span>
<span class="c"></span>        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elCategoryFilters</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_createCategoryCheckbox</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Initializes source filters.</span>
<span class="c"> *</span>
<span class="c"> * @method _initSources</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_initSources</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// Initialize source filters</span>
<span class="c"></span>    <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span> <span class="o">=</span> <span class="o">[];</span>
    <span class="k">var</span> <span class="nx">aInitialSources</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">sources</span><span class="o">;</span>

    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">j</span> <span class="o">&lt;</span> <span class="nx">aInitialSources</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">j</span><span class="o">++)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">sSource</span> <span class="o">=</span> <span class="nx">aInitialSources</span><span class="o">[</span><span class="nx">j</span><span class="o">];</span>

        <span class="c">// Add source to the internal array of filters</span>
<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">sSource</span><span class="o">);</span>

        <span class="c">// Add checkbox element if UI is enabled</span>
<span class="c"></span>        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elSourceFilters</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_createSourceCheckbox</span><span class="o">(</span><span class="nx">sSource</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}}</span>
<span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * Creates the UI for a category filter in the LogReader footer element.</span>
<span class="c"> *</span>
<span class="c"> * @method _createCategoryCheckbox</span>
<span class="c"> * @param sCategory {String} Category name.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_createCategoryCheckbox</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sCategory</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">elParent</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elCategoryFilters</span><span class="o">;</span>
        <span class="k">var</span> <span class="nx">elFilter</span> <span class="o">=</span> <span class="nx">elParent</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;span&quot;</span><span class="o">));</span>
        <span class="nx">elFilter</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filtergrp&quot;</span><span class="o">;</span>
        
        <span class="c">// Append el at the end so IE 5.5 can set &quot;type&quot; attribute</span>
<span class="c"></span>        <span class="c">// and THEN set checked property</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">chkCategory</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;input&quot;</span><span class="o">);</span>
        <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filter-&quot;</span> <span class="o">+</span> <span class="nx">sCategory</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sName</span><span class="o">;</span>
        <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filter-&quot;</span> <span class="o">+</span> <span class="nx">sCategory</span><span class="o">;</span>
        <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">&quot;checkbox&quot;</span><span class="o">;</span>
        <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">category</span> <span class="o">=</span> <span class="nx">sCategory</span><span class="o">;</span>
        <span class="nx">chkCategory</span> <span class="o">=</span> <span class="nx">elFilter</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">chkCategory</span><span class="o">);</span>
        <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

        <span class="c">// Subscribe to the click event</span>
<span class="c"></span>        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="nx">chkCategory</span><span class="o">,</span><span class="s1">&#39;click&#39;</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_onCheckCategory</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">);</span>

        <span class="c">// Create and class the text label</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">lblCategory</span> <span class="o">=</span> <span class="nx">elFilter</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;label&quot;</span><span class="o">));</span>
        <span class="nx">lblCategory</span><span class="o">.</span><span class="nx">htmlFor</span> <span class="o">=</span> <span class="nx">chkCategory</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
        <span class="nx">lblCategory</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="nx">sCategory</span><span class="o">;</span>
        <span class="nx">lblCategory</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">sCategory</span><span class="o">;</span>
        
        <span class="k">this</span><span class="o">.</span><span class="nx">_filterCheckboxes</span><span class="o">[</span><span class="nx">sCategory</span><span class="o">]</span> <span class="o">=</span> <span class="nx">chkCategory</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Creates a checkbox in the LogReader footer element to filter by source.</span>
<span class="c"> *</span>
<span class="c"> * @method _createSourceCheckbox</span>
<span class="c"> * @param sSource {String} Source name.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_createSourceCheckbox</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sSource</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">oSelf</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">elParent</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elSourceFilters</span><span class="o">;</span>
        <span class="k">var</span> <span class="nx">elFilter</span> <span class="o">=</span> <span class="nx">elParent</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;span&quot;</span><span class="o">));</span>
        <span class="nx">elFilter</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filtergrp&quot;</span><span class="o">;</span>

        <span class="c">// Append el at the end so IE 5.5 can set &quot;type&quot; attribute</span>
<span class="c"></span>        <span class="c">// and THEN set checked property</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">chkSource</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;input&quot;</span><span class="o">);</span>
        <span class="nx">chkSource</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filter&quot;</span> <span class="o">+</span> <span class="nx">sSource</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sName</span><span class="o">;</span>
        <span class="nx">chkSource</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;yui-log-filter&quot;</span> <span class="o">+</span> <span class="nx">sSource</span><span class="o">;</span>
        <span class="nx">chkSource</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">&quot;checkbox&quot;</span><span class="o">;</span>
        <span class="nx">chkSource</span><span class="o">.</span><span class="nx">source</span> <span class="o">=</span> <span class="nx">sSource</span><span class="o">;</span>
        <span class="nx">chkSource</span> <span class="o">=</span> <span class="nx">elFilter</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">chkSource</span><span class="o">);</span>
        <span class="nx">chkSource</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

        <span class="c">// Subscribe to the click event</span>
<span class="c"></span>        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="nx">chkSource</span><span class="o">,</span><span class="s1">&#39;click&#39;</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_onCheckSource</span><span class="o">,</span><span class="nx">oSelf</span><span class="o">);</span>

        <span class="c">// Create and class the text label</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">lblSource</span> <span class="o">=</span> <span class="nx">elFilter</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;label&quot;</span><span class="o">));</span>
        <span class="nx">lblSource</span><span class="o">.</span><span class="nx">htmlFor</span> <span class="o">=</span> <span class="nx">chkSource</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
        <span class="nx">lblSource</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="nx">sSource</span><span class="o">;</span>
        <span class="nx">lblSource</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">sSource</span><span class="o">;</span>
        
        <span class="k">this</span><span class="o">.</span><span class="nx">_filterCheckboxes</span><span class="o">[</span><span class="nx">sSource</span><span class="o">]</span> <span class="o">=</span> <span class="nx">chkSource</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Reprints all log messages in the stack through filters.</span>
<span class="c"> *</span>
<span class="c"> * @method _filterLogs</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_filterLogs</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="c">// Reprint stack with new filters</span>
<span class="c"></span>    <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span> <span class="o">!==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">clearConsole</span><span class="o">();</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_printToConsole</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">.</span><span class="nx">getStack</span><span class="o">());</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Sends buffer of log messages to output and clears buffer.</span>
<span class="c"> *</span>
<span class="c"> * @method _printBuffer</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_printBuffer</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span> <span class="o">!==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">thresholdMax</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">thresholdMax</span><span class="o">;</span>
        <span class="nx">thresholdMax</span> <span class="o">=</span> <span class="o">(</span><span class="nx">thresholdMax</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nb">isNaN</span><span class="o">(</span><span class="nx">thresholdMax</span><span class="o">))</span> <span class="o">?</span> <span class="nx">thresholdMax</span> <span class="o">:</span> <span class="m">500</span><span class="o">;</span>
        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_consoleMsgCount</span> <span class="o">&lt;</span> <span class="nx">thresholdMax</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">entries</span> <span class="o">=</span> <span class="o">[];</span>
            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="k">this</span><span class="o">.</span><span class="nx">_buffer</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
                <span class="nx">entries</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_buffer</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
            <span class="o">}</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_buffer</span> <span class="o">=</span> <span class="o">[];</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_printToConsole</span><span class="o">(</span><span class="nx">entries</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">else</span> <span class="o">{</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
        <span class="o">}</span>
        
        <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">newestOnTop</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">scrollTop</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">scrollHeight</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Cycles through an array of log messages, and outputs each one to the console</span>
<span class="c"> * if its category has not been filtered out.</span>
<span class="c"> *</span>
<span class="c"> * @method _printToConsole</span>
<span class="c"> * @param aEntries {Object[]} Array of LogMsg objects to output to console.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_printToConsole</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">aEntries</span><span class="o">)</span> <span class="o">{</span>
    <span class="c">// Manage the number of messages displayed in the console</span>
<span class="c"></span>    <span class="k">var</span> <span class="nx">entriesLen</span> <span class="o">=</span> <span class="nx">aEntries</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
    <span class="k">var</span> <span class="nx">thresholdMin</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">thresholdMin</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(</span><span class="nb">isNaN</span><span class="o">(</span><span class="nx">thresholdMin</span><span class="o">)</span> <span class="o">||</span> <span class="o">(</span><span class="nx">thresholdMin</span> <span class="o">&gt;</span> <span class="k">this</span><span class="o">.</span><span class="nx">thresholdMax</span><span class="o">))</span> <span class="o">{</span>
        <span class="nx">thresholdMin</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
    <span class="o">}</span>
    <span class="k">var</span> <span class="nx">entriesStartIndex</span> <span class="o">=</span> <span class="o">(</span><span class="nx">entriesLen</span> <span class="o">&gt;</span> <span class="nx">thresholdMin</span><span class="o">)</span> <span class="o">?</span> <span class="o">(</span><span class="nx">entriesLen</span> <span class="o">-</span> <span class="nx">thresholdMin</span><span class="o">)</span> <span class="o">:</span> <span class="m">0</span><span class="o">;</span>
    
    <span class="c">// Iterate through all log entries </span>
<span class="c"></span>    <span class="k">var</span> <span class="nx">sourceFiltersLen</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
    <span class="k">var</span> <span class="nx">categoryFiltersLen</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="nx">entriesStartIndex</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">entriesLen</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
        <span class="c">// Print only the ones that filter through</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">okToPrint</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
        <span class="k">var</span> <span class="nx">okToFilterCats</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

        <span class="c">// Get log message details</span>
<span class="c"></span>        <span class="k">var</span> <span class="nx">entry</span> <span class="o">=</span> <span class="nx">aEntries</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
        <span class="k">var</span> <span class="nx">source</span> <span class="o">=</span> <span class="nx">entry</span><span class="o">.</span><span class="nx">source</span><span class="o">;</span>
        <span class="k">var</span> <span class="nx">category</span> <span class="o">=</span> <span class="nx">entry</span><span class="o">.</span><span class="nx">category</span><span class="o">;</span>

        <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">j</span><span class="o">&lt;</span><span class="nx">sourceFiltersLen</span><span class="o">;</span> <span class="nx">j</span><span class="o">++)</span> <span class="o">{</span>
            <span class="k">if</span><span class="o">(</span><span class="nx">source</span> <span class="o">==</span> <span class="k">this</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">[</span><span class="nx">j</span><span class="o">])</span> <span class="o">{</span>
                <span class="nx">okToFilterCats</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
                <span class="k">break</span><span class="o">;</span>
            <span class="o">}</span>
        <span class="o">}</span>
        <span class="k">if</span><span class="o">(</span><span class="nx">okToFilterCats</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">k</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">k</span><span class="o">&lt;</span><span class="nx">categoryFiltersLen</span><span class="o">;</span> <span class="nx">k</span><span class="o">++)</span> <span class="o">{</span>
                <span class="k">if</span><span class="o">(</span><span class="nx">category</span> <span class="o">==</span> <span class="k">this</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">[</span><span class="nx">k</span><span class="o">])</span> <span class="o">{</span>
                    <span class="nx">okToPrint</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
                    <span class="k">break</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
        <span class="o">}</span>
        <span class="k">if</span><span class="o">(</span><span class="nx">okToPrint</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">output</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">formatMsg</span><span class="o">(</span><span class="nx">entry</span><span class="o">);</span>
            <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">newestOnTop</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">output</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">innerHTML</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>
                <span class="k">this</span><span class="o">.</span><span class="nx">_elConsole</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">+=</span> <span class="nx">output</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_consoleMsgCount</span><span class="o">++;</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_lastTime</span> <span class="o">=</span> <span class="nx">entry</span><span class="o">.</span><span class="nx">time</span><span class="o">.</span><span class="nx">getTime</span><span class="o">();</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c">//</span>
<span class="c">// Private event handlers</span>
<span class="c">//</span>
<span class="c">/////////////////////////////////////////////////////////////////////////////</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * Handles Logger&#39;s categoryCreateEvent.</span>
<span class="c"> *</span>
<span class="c"> * @method _onCategoryCreate</span>
<span class="c"> * @param sType {String} The event.</span>
<span class="c"> * @param aArgs {Object[]} Data passed from event firer.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onCategoryCreate</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sType</span><span class="o">,</span> <span class="nx">aArgs</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">category</span> <span class="o">=</span> <span class="nx">aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
    
    <span class="c">// Add category to the internal array of filters</span>
<span class="c"></span>    <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_categoryFilters</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">category</span><span class="o">);</span>

    <span class="k">if</span><span class="o">(</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_createCategoryCheckbox</span><span class="o">(</span><span class="nx">category</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles Logger&#39;s sourceCreateEvent.</span>
<span class="c"> *</span>
<span class="c"> * @method _onSourceCreate</span>
<span class="c"> * @param sType {String} The event.</span>
<span class="c"> * @param aArgs {Object[]} Data passed from event firer.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onSourceCreate</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sType</span><span class="o">,</span> <span class="nx">aArgs</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">source</span> <span class="o">=</span> <span class="nx">aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
    
    <span class="c">// Add source to the internal array of filters</span>
<span class="c"></span>    <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_sourceFilters</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">source</span><span class="o">);</span>

    <span class="k">if</span><span class="o">(</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_elFt</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_createSourceCheckbox</span><span class="o">(</span><span class="nx">source</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles check events on the category filter checkboxes.</span>
<span class="c"> *</span>
<span class="c"> * @method _onCheckCategory</span>
<span class="c"> * @param v {HTMLEvent} The click event.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onCheckCategory</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">category</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">category</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">checked</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">hideCategory</span><span class="o">(</span><span class="nx">category</span><span class="o">);</span>
    <span class="o">}</span>
    <span class="k">else</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">showCategory</span><span class="o">(</span><span class="nx">category</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles check events on the category filter checkboxes.</span>
<span class="c"> *</span>
<span class="c"> * @method _onCheckSource</span>
<span class="c"> * @param v {HTMLEvent} The click event.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onCheckSource</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">source</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">source</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">checked</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">hideSource</span><span class="o">(</span><span class="nx">source</span><span class="o">);</span>
    <span class="o">}</span>
    <span class="k">else</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">showSource</span><span class="o">(</span><span class="nx">source</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles click events on the collapse button.</span>
<span class="c"> *</span>
<span class="c"> * @method _onClickCollapseBtn</span>
<span class="c"> * @param v {HTMLEvent} The click event.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onClickCollapseBtn</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">if</span><span class="o">(!</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">isCollapsed</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">collapse</span><span class="o">();</span>
    <span class="o">}</span>
    <span class="k">else</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">expand</span><span class="o">();</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles click events on the pause button.</span>
<span class="c"> *</span>
<span class="c"> * @method _onClickPauseBtn</span>
<span class="c"> * @param v {HTMLEvent} The click event.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onClickPauseBtn</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">if</span><span class="o">(!</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">isPaused</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">pause</span><span class="o">();</span>
    <span class="o">}</span>
    <span class="k">else</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">resume</span><span class="o">();</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles click events on the clear button.</span>
<span class="c"> *</span>
<span class="c"> * @method _onClickClearBtn</span>
<span class="c"> * @param v {HTMLEvent} The click event.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onClickClearBtn</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="nx">oSelf</span><span class="o">.</span><span class="nx">clearConsole</span><span class="o">();</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles Logger&#39;s newLogEvent.</span>
<span class="c"> *</span>
<span class="c"> * @method _onNewLog</span>
<span class="c"> * @param sType {String} The event.</span>
<span class="c"> * @param aArgs {Object[]} Data passed from event firer.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onNewLog</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sType</span><span class="o">,</span> <span class="nx">aArgs</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">logEntry</span> <span class="o">=</span> <span class="nx">aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
    <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_buffer</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">logEntry</span><span class="o">);</span>

    <span class="k">if</span> <span class="o">(</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">logReaderEnabled</span> <span class="o">===</span> <span class="kc">true</span> <span class="o">&amp;&amp;</span> <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">===</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_timeout</span> <span class="o">=</span> <span class="nx">setTimeout</span><span class="o">(</span><span class="k">function</span><span class="o">(){</span><span class="nx">oSelf</span><span class="o">.</span><span class="nx">_printBuffer</span><span class="o">();},</span> <span class="nx">oSelf</span><span class="o">.</span><span class="nx">outputBuffer</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Handles Logger&#39;s resetEvent.</span>
<span class="c"> *</span>
<span class="c"> * @method _onReset</span>
<span class="c"> * @param sType {String} The event.</span>
<span class="c"> * @param aArgs {Object[]} Data passed from event firer.</span>
<span class="c"> * @param oSelf {Object} The LogReader instance.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">LogReader</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">_onReset</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">sType</span><span class="o">,</span> <span class="nx">aArgs</span><span class="o">,</span> <span class="nx">oSelf</span><span class="o">)</span> <span class="o">{</span>
    <span class="nx">oSelf</span><span class="o">.</span><span class="nx">_filterLogs</span><span class="o">();</span>
<span class="o">};</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_button.html">button</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_colorpicker.html">colorpicker</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class=""><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_datasource.html">datasource</a></li>

                                <li class=""><a href="module_datatable.html">datatable</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_editor.html">editor</a></li>

                                <li class=""><a href="module_element.html">element</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_history.html">history</a></li>

                                <li class=""><a href="module_imageloader.html">imageloader</a></li>

                                <li class="selected"><a href="module_logger.html">logger</a></li>

                                <li class=""><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class=""><a href="module_yahoo.html">yahoo</a></li>

                                <li class=""><a href="module_yuiloader.html">yuiloader</a></li>

                                <li class=""><a href="module_yuitest.html">yuitest</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.widget.Logger.html">YAHOO.widget.Logger</a></li>
                                <li class=""><a href="YAHOO.widget.LogMsg.html">YAHOO.widget.LogMsg</a></li>
                                <li class=""><a href="YAHOO.widget.LogReader.html">YAHOO.widget.LogReader</a></li>
                                <li class=""><a href="YAHOO.widget.LogWriter.html">YAHOO.widget.LogWriter</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Logger.js.html">Logger.js</a></li>
                                <li class=""><a href="LogMsg.js.html">LogMsg.js</a></li>
                                <li class="selected"><a href="LogReader.js.html">LogReader.js</a></li>
                                <li class=""><a href="LogWriter.js.html">LogWriter.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
